/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package RDA;

import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.geom.Rectangle;
import org.newdawn.slick.state.StateBasedGame;

/**
 *
 * @author wida46984148
 */
public class DisparoWida extends Disparo {

    Image bala;

    public DisparoWida(float daño, Image bala) {
        super(daño);
        this.bala = bala;
    }

    @Override
    public void posicion(float x, float y) {
        super.posicion(x, y);
        super.s = new Rectangle(x, y, bala.getWidth(), bala.getHeight());
    }

    public void update(int delta) {
        if (!(destruido)) {
            if (y <= 5) {
                y = 10;
                x = 1300;
            } else {
                y -= 10;
                s.setLocation(x, y);
            }
        } else {
            y = 0;
            x = 1300;
            s.setLocation(x, y);

        }
    }

    @Override
    public void render(GameContainer gc, Graphics g) {
        g.drawImage(bala, x, y);
    }

    @Override
    public Disparo copiarDisparo() {
        return new DisparoWida(daño, bala);
    }

    @Override
    public Disparo clonarDisparo() {
        Disparo d = (Disparo) copiarDisparo();
        d.posicion(x, y);
        return d;
    }

    public void impacto() {
        this.destruido = true;
    }

    public Image getBala(){
        return bala;
    }

    @Override
    public void update(GameContainer gc, StateBasedGame sb, int delta) {
        throw new UnsupportedOperationException("Not supported yet.");
    }


}
